#!/usr/bin/python
# -*- coding: utf-8 -*-
# Create at 2008-9-1
# Author: MK2[fengmk2@gmail.com]

import time
from net4.utilities.threads import timeout, Timeout

@timeout(5)
def method_timeout(seconds, text):
    print 'start', seconds, text
    time.sleep(seconds)
    print 'finish', seconds, text
    return seconds

if __name__ == '__main__':
    for sec in range(1, 10):
        try:
            print '*' * 20
            print method_timeout(sec, 'test waiting %d seconds' % sec)
        except Timeout, e:
            print e